<template>
  <!-- 底部菜单部分 -->
  <ul class="footer">
    <li>
      <i class="fa fa-home"></i>
      <p @click="toIndex">首页</p>
    </li>
    <li>
      <i class="fa fa-compass"></i>
      <p @click="toSearch">发现</p>
    </li>
    <li>
      <i class="fa fa-file-text-o"></i>
      <p @click="toOrderList">订单</p>
    </li>
    <li>
      <i class="fa fa-user-o"></i>
      <!-- <i class="far fa-cart-plus" /> -->
      <p @click="toLoginOrInfo">我的</p>
    </li>
  </ul>
</template>

<script>
export default {
  //定义函数
  methods: {
    toOrderList() {
      //编程式路由
      this.$router.push("/orderList");
    },
    toLoginOrInfo() {
      let user = JSON.parse(sessionStorage.getItem("user"));
      if (user != null) {
        this.$router.push("/userInfo");
      } else {
        this.$router.push("/login");
      }
    },
    toIndex() {
      this.$router.push("/index");
    },
    toSearch(){
      this.$router.push("/search");
    }
  }
};
</script>

<style scoped>
/****************** 底部菜单部分 ******************/
.footer {
  width: 100%;
  height: 14vw;
  border-top: solid 1px #ddd;
  background-color: #fff;

  position: fixed;
  left: 0;
  bottom: 0;

  display: flex;
  justify-content: space-around;
  align-items: center;
}
.footer li {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  color: #999;
  user-select: none;
  cursor: pointer;
}
.footer li p {
  font-size: 2.8vw;
}
.footer li i {
  font-size: 5vw;
}
</style>